package com.itheima.stock.mapper;

import com.itheima.stock.common.domian.StockUpdownDomain;
import com.itheima.stock.common.domian.StockWeekLineDomain;
import com.itheima.stock.pojo.StockRtInfo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author hyn
 * @description 针对表【stock_rt_info(个股详情信息表)】的数据库操作Mapper
 * @createDate 2022-05-30 01:02:49
 * @Entity com.itheima.stock.pojo.StockRtInfo
 */
@Repository
public interface StockRtInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockRtInfo record);

    int insertSelective(StockRtInfo record);

    StockRtInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockRtInfo record);

    int updateByPrimaryKey(StockRtInfo record);

    /**
     * 查询时间段内的股票信息
     *
     * @param date  最近交易时间
     * @param limit 查询几条数据
     * @return
     */
    List<StockUpdownDomain> queryAllStock_rt(@Param("date") Date date, @Param("limit") Integer limit);

    /**
     * 查询股票最近时间段内的涨幅跌幅
     *
     * @param openTime  开始时间
     * @param endTime   结束时间
     * @param upDownNum upDownNum 区分涨幅还是跌幅
     * @return
     */
     @MapKey("id")
    List<Map> queryAllUpDown(@Param("openTime") Date openTime, @Param("endTime") Date endTime, @Param("upDownNum") Integer upDownNum);


    @MapKey("id")
    List<Map> queryAllStockGainByDate(@Param("date") Date recentTimePoint);

    List<StockWeekLineDomain> selectAllData(String code, Object o, Object o1);
}
